package com.mail.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mail.pojo.EmailTeam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmailTeamMapper extends BaseMapper<EmailTeam> {
    @Select("select id,team_name,team_manager,team_notes,create_time from email_team where id in(select team_id from team_member where member_id =#{memberId}) limit #{firstIndex},#{lengths}")
    List<EmailTeam> queryTeamByMember(@Param("memberId") long memberId,@Param("firstIndex") int firstIndex,@Param("lengths")int lengths);

    @Select("select count(*) from email_team where id in(select team_id from team_member where member_id =#{memberId})")
    long queryTeamByMemberCount(@Param("memberId") long memberId);
}
